package com.example.spzx.Service.impl;

import com.example.spzx.Mapper.CategoryBrandMapper;
import com.example.spzx.Service.CategoryBrandService;
import com.example.spzx.model.entity.product.CategoryBrand;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class CategoryBrandServiceImpl implements CategoryBrandService {
 @Resource
 private CategoryBrandMapper categoryBrandMapper;
    public PageInfo<CategoryBrand> getlist(Integer page,Integer limit,Integer brandId, Integer categoryId){
        PageHelper.startPage(page,limit);
        Page<CategoryBrand> page1=categoryBrandMapper.getlist(brandId,categoryId);
        PageInfo<CategoryBrand> pageInfo=new PageInfo<>();
        pageInfo.setList(page1.getResult());
        pageInfo.setTotal(page1.getTotal());
        return pageInfo;
    }
    public  void add(CategoryBrand categoryBrand){
        categoryBrandMapper.add(categoryBrand);
    }
    public     void updateById(CategoryBrand categoryBrand){
        categoryBrandMapper.updateById(categoryBrand);
    }
    public  void delete(Integer id){
        categoryBrandMapper.delete(id);

    }
}
